﻿@using EquipmentAlarmSystem.Service.Models.Enum
@model Configure

@{
    ViewData["Title"] = "联系人";
}

<partial name="_SystemConfiguration" />

<style>
    table {
        border-collapse: collapse; /* 合并表格边框为一个单一的边框 */
        margin: 0 auto;
    }

    table, th, td {
        border: 1px solid black; /* 设置表格、表头和表格单元格的边框为1像素宽的黑色实线 */
        text-align: center; /* 水平居中 */
    }

    input {
        border: none;
        width: 100%;
        text-align: center; /* 水平居中 */
    }

    select {
        border: none;
        width: 100%;
        text-align: center; /* 水平居中 */
    }

    tr {
        height: 35px;
    }
</style>

<table>
    <tr>
        <th width="200px">姓名</th>
        <th width="200px">电话</th>
        <th width="100px">启用短信</th>
        <th width="100px">启用拨号</th>
        <th width="200px">分组</th>
        <th width="80px"></th>
    </tr>
    @foreach (var item in Model.Contacts)
    {
        <form action="/SystemConfiguration/Contacts" method="post">
        <tr>
            <th><input type="text" name="Name" value="@item.Name" required></th>
            <th><input type="text" name="PhoneNumber" value="@item.PhoneNumber" required></th>
            <th>
                <input type="checkbox" id="EnableSms" name="EnableSms" value="true" @if (item.EnableSms)
                    {
                        <text>checked="checked"</text>
                    }>
            </th>
            <th>
                <input type="checkbox" id="EnableDialing" name="EnableDialing" value="true" @if (item.EnableDialing)
                    {
                        <text>checked="checked"</text>
                    }>
            </th>
            <th>
                <select asp-for="@item.Level" asp-items="Html.GetEnumSelectList<UserLevel>()" name="Level"></select>
            </th>
            <th>
                <input type="submit" value="提交">
            </th>
        </tr>
        <!-- 提交按钮 -->
        </form>
    }

    <form action="/SystemConfiguration/Contacts" method="post">
    <tr>
        <th><input type="text" name="Name" required></th>
        <th><input type="text" name="PhoneNumber" required></th>
        <th>
            <input type="checkbox" id="EnableSms" name="EnableSms">
        </th>
        <th>
            <input type="checkbox" id="EnableDialing" name="EnableDialing">
        </th>
        <th>
            <select asp-items="Html.GetEnumSelectList<UserLevel>()" name="Level"></select>
        </th>
        <th>
            <input type="submit" value="提交">
        </th>
    </tr>
    <!-- 提交按钮 -->
    </form>
</table>
